import React, { Component } from 'react'
import { HashRouter, Route, Redirect, Switch } from 'react-router-dom'
import App from '../App'
import Admin from '../Route/admin'
import Login from '../pages/Login'
import Home from '../pages/Home'
import NoMatch from '../components/NoMatch'
import Button from '../pages/Ui/Button'
import Modal from '../pages/Ui/Modal'
import Loading from '../pages/Ui/Loading'
import Notice from '../pages/Ui/Notification'
import Message from '../pages/Ui/Message'
import Tab from '../pages/Ui/Tabs'
import Gallery from '../pages/Ui/Gallery'
import Carousel from '../pages/Ui/Carousel'
import FLogin from '../pages/Form/Login'
import Register from '../pages/Form/Register'
import BasicTable from '../pages/Table/basicTable'
import HeighTable from '../pages/Table/highTable'
import Rich from '../pages/Rich/index'
import City from '../pages/City/index'
import Order from '../pages/Order'
import Common from '../common'
import OrderDetail from '../pages/Order/orderDetail'
import User from '../pages/User'
import Map from '../pages/Map'
import Bar from '../pages/Echarts/Bar'
import Pie from '../pages/Echarts/Pie'
import Line from '../pages/Echarts/Line'
import Permission from '../pages/Permission'


class ERoute extends Component {
    render() {
        return (
            <HashRouter>
                <App>
                    <Switch>
                        <Route path="/login" component={Login} />
                        <Route path="/common" render={()=>
                            <Common>
                                <Route path="/common/order/detail/:orderId" component={OrderDetail} />
                            </Common>
                        } />
                        <Route path="/" render={() =>
                            <Admin>
                                <Switch>
                                    <Route path="/home" component={Home} />
                                    <Route path="/ui/buttons" component={Button}/>
                                    <Route path="/ui/modals" component={Modal}/>
                                    <Route path="/ui/loadings" component={Loading}/>
                                    <Route path="/ui/notification" component={Notice}/>
                                    <Route path="/ui/messages" component={Message}/>
                                    <Route path="/ui/tabs" component={Tab}/>
                                    <Route path="/ui/gallery" component={Gallery}/>
                                    <Route path="/ui/carousel" component={Carousel}/>
                                    <Route path="/form/login" component={FLogin}/>
                                    <Route path="/form/reg" component={Register}/>
                                    <Route path="/table/basic" component={BasicTable}/>
                                    <Route path="/table/high" component={HeighTable}/>
                                    <Route path="/rich" component={Rich}/>
                                    <Route path="/city" component={City}/>
                                    <Route path="/order" component={Order}/>
                                    <Route path="/user" component={User}/>
                                    <Route path="/bikeMap" component={Map}/>
                                    <Route path="/charts/bar" component={Bar}/>
                                    <Route path="/charts/pie" component={Pie}/>
                                    <Route path="/charts/line" component={Line}/>
                                    <Route path="/permission" component={Permission}/>
                                    <Redirect to="/home"/>
                                    <Route component={NoMatch} />
                                </Switch>
                            </Admin>
                        } />
                    </Switch>
                </App>
            </HashRouter>
        )
    }
}
export default ERoute